package entities.extra;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 * Trabalho PD - 2014/2015
 * @author a21210380 a21210392
 */
@Embeddable
public class UserTripParticipationPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "idUser")
    private int idUser;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "idTrip")
    private int idTrip;

    public UserTripParticipationPK() {
    }

    public UserTripParticipationPK(int idUser, int idTrip) {
        this.idUser = idUser;
        this.idTrip = idTrip;
    }

    public int getIdUser() {
        return idUser;
    }

    public int getIdTrip() {
        return idTrip;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) idUser;
        hash += (int) idTrip;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserTripParticipationPK)) {
            return false;
        }
        UserTripParticipationPK other = (UserTripParticipationPK) object;
        if (this.idUser != other.idUser) {
            return false;
        }
        return this.idTrip == other.idTrip;
    }

    @Override
    public String toString() {
        return "entities.extra.UserTripParticipationPK[ idUser=" + idUser + ", idTrip=" + idTrip + " ]";
    }

}
